const state = {
	stockInGoods: uni.getStorageSync('stockInGoods') || {},
	scanCode: uni.getStorageSync('scanCode') || [],
	scanGoodsCode: uni.getStorageSync('scanGoodsCode') || '',   // 商品对码扫码
	companyGoods:uni.getStorageSync('companyGoodsList') || [],   // 商品对码扫码
	companygood:uni.getStorageSync('companyGood') || {}, //当前扫码商品
	companyTuiGoods:uni.getStorageSync('companyTuiGoodsList') || [],   // 商品对码扫码
	companyTuigood:uni.getStorageSync('companyTuiGood') || {} //当前扫码商品
}

const getters = {}

const actions = {
	
}

// mutations
const mutations = {
	//扫码溯源更新
	initStockInGoods(state, provider) {
		state.stockInGoods = provider;
		uni.setStorage({  //缓存
		    key: 'stockInGoods',  
		    data: provider  
		})
	},
	//缓存当前扫码商品
	initCompanyGood(state,provider){
		state.companygood = provider;
		uni.setStorage({  //缓存
		    key: 'companyGood',  
		    data: provider  
		})
	},
	//缓存商品列表
	initCompanyGoods(state,provider){
		state.companyGoods = provider;
		uni.setStorage({  //缓存
		    key: 'companyGoodsList',  
		    data: provider  
		})
	},
	//缓存当前扫码商品
	initCompanyTuiGood(state,provider){
		state.companyTuigood = provider;
		uni.setStorage({  //缓存
		    key: 'companyTuiGood',  
		    data: provider  
		})
	},
	//缓存商品列表
	initCompanyTuiGoods(state,provider){
		state.companyTuiGoods = provider;
		uni.setStorage({  //缓存
		    key: 'companyTuiGoodsList',  
		    data: provider  
		})
	},
	initScanCode(state, provider) {
		state.scanCode = provider;
		uni.setStorage({  //缓存
		    key: 'scanCode',  
		    data: provider  
		})
	},
	cleanScanCode() {
		state.scanCode = '';
		uni.setStorage({  //缓存
		    key: 'scanCode',  
		    data: ''  
		})
	},
	initScanGoodsCode(state, provider) {
		state.scanGoodsCode = provider;
		uni.setStorage({  //缓存
		    key: 'scanGoodsCode',  
		    data: provider  
		})
	},
	cleanScanGoodsCode() {
		state.scanGoodsCode = '';
		uni.setStorage({  //缓存
		    key: 'scanGoodsCode',  
		    data: ''  
		})
	},
}

export default {
	state,
	getters,
	actions,
	mutations
}